package org.example.work2.tcc.account.service;


import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;
import org.example.work2.tcc.account.dto.Account;

@LocalTCC
public interface AccountAction {

	public Account findAccountByCode(String accountCode);

//	public boolean updateScores(Account account) throws Exception;

	@TwoPhaseBusinessAction(name = "accountAction", commitMethod = "updateScoresCommit", rollbackMethod = "updateScoresRollBack")
	boolean updateScoresPrepare(BusinessActionContext actionContext,
							   @BusinessActionContextParameter("accountCode") String accountCode,
							   @BusinessActionContextParameter("frozenScores") Integer frozenScores) throws Exception;

	boolean updateScoresCommit(BusinessActionContext actionContext) throws Exception;

	boolean updateScoresRollBack(BusinessActionContext actionContext) throws Exception;

}
